/**
 * Copyright (c) 2013-2016, Jieven. All rights reserved.
 *
 * Licensed under the GPL license: http://www.gnu.org/licenses/gpl.txt
 * To use it on other terms please contact us at 1623736450@qq.com
 */
package com.oss;

import com.eova.config.MyConfig;
import com.eova.widget.tform.TformController;
import com.game.betLottery.api.BetOrLotteryApi;
import com.game.betLottery.api.GameRuleInfoApi;
import com.game.betLottery.model.Bet;
import com.game.betLottery.model.GameRuleInfo;
import com.game.betLottery.model.Lottery;
import com.game.hall.api.RoomInfoApi;
import com.game.hall.model.GameUser;
import com.game.hall.model.RoomInfo;
import com.game.hall.model.RoomUserInfo;
import com.game.message.api.SystmMesageApi;
import com.game.message.model.GameUserMessage;
import com.game.message.model.SysteMsage;
import com.game.my.api.AddMoneyApi;
import com.game.my.api.MyMesageApi;
import com.game.my.model.Account;
import com.game.my.model.GameInfo;
import com.game.my.model.GameNum;
import com.game.my.model.MyMesage;
import com.game.my.model.RomtalInfo;
import com.game.task.api.GameTaskApi;
import com.game.task.model.GameTask;
import com.game.task.model.GameTaskUser;
import com.jfinal.config.Plugins;
import com.jfinal.config.Routes;
import com.jfinal.core.JFinal;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.newsReader.article.api.ArticleApi;
import com.newsReader.article.model.Article;
import com.newsReader.article.model.User;
import com.newsReader.banner.api.BannerApi;
import com.newsReader.banner.model.Banner;
import com.newsReader.category.api.CategoryApi;
import com.newsReader.category.model.CateUser;
import com.newsReader.category.model.Category;
import com.oss.mo.controller.TestController;
import com.oss.model.Hotel;
import com.oss.model.OrderItem;
import com.oss.model.Orders;
import com.oss.model.Product;
import com.zhihu.chat.model.Chat;
import com.zhihu.follow.api.FollowApi;
import com.zhihu.follow.model.Follow;
import com.zhihu.notify.api.ZNoticeApi;
import com.zhihu.notify.model.ZNotice;
import com.zhihu.zhihuquan.api.AnswerApi;
import com.zhihu.zhihuquan.model.Answer;
import com.zhihu.zhihuquan.model.Problem;
import com.zhihu.zhihuquan.model.Topic;
import com.zhihu.zixun.api.ZixunApi;
import com.zhihu.zixun.model.ZProblem;

public class OSSConfig extends MyConfig {

	/**
	 * 自定义路由
	 * 
	 * @param me
	 */
	@Override
	protected void route(Routes me) {
		// 自定义的路由配置往这里加。。。
		me.add("/test", TestController.class);
		me.add("/gameTask", GameTaskApi.class);
		me.add("/queryMesage", SystmMesageApi.class);
		me.add("/MyMesage", MyMesageApi.class);
		me.add("/AddMoneyApi", AddMoneyApi.class);
		me.add("/betorlottery", BetOrLotteryApi.class);
		me.add("/room", RoomInfoApi.class);
		me.add("/gameRuleInfo", GameRuleInfoApi.class);

		// 知乎
		me.add("/answer", AnswerApi.class);
		me.add("/zixun", ZixunApi.class);
		me.add("/notice", ZNoticeApi.class);
		me.add("/follow", FollowApi.class);
		me.add("/BannerApi", BannerApi.class);
		me.add("/CategoryApi", CategoryApi.class);
		me.add("/ArticleApi", ArticleApi.class);
		me.add("/tform", TformController.class);
	}

	/**
	 * 自定义Main数据源Model映射
	 * 
	 * @param arp
	 */
	@Override
	protected void mapping(ActiveRecordPlugin arp) {

		arp.addMapping("hotel", Hotel.class);
		arp.addMapping("product", Product.class);
		arp.addMapping("orders", Orders.class);
		arp.addMapping("order_item", OrderItem.class);
		// 游戏-任务
		arp.addMapping("game_task", GameTask.class);
		arp.addMapping("game_task_user", GameTaskUser.class);
		arp.addMapping("announcement_info", SysteMsage.class);// 系统消息
		arp.addMapping("game_user", MyMesage.class);// 我的消息
		arp.addMapping("game_info", GameInfo.class);
		arp.addMapping("room_info", RoomInfo.class);// 房间
		arp.addMapping("game_detail_info", RomtalInfo.class);// 房间
		arp.addMapping("game_detail_info", GameNum.class);// 游戏胜率方面的消息
		arp.addMapping("user_account_info", Account.class);// 用户账户信息表
		arp.addMapping("game_detail_info", Bet.class);// 押注
		arp.addMapping("game_info", Lottery.class);// 开奖
		arp.addMapping("room_info", RoomInfo.class);// 房间信息
		arp.addMapping("game_rule_info", GameRuleInfo.class);// 赔率
		arp.addMapping("game_user", GameUser.class);
		arp.addMapping("room_user_info", RoomUserInfo.class);

		arp.addMapping("c_category", Category.class);
		arp.addMapping("c_banner", Banner.class);
		arp.addMapping("n_article", Article.class);

		arp.addMapping("game_user_message", GameUserMessage.class);
		arp.addMapping("n_cateUser", CateUser.class);
		arp.addMapping("c_user", User.class);
		// 自定义的Model映射往这里加。。。

		// 知乎

		arp.addMapping("z_answer", Answer.class);

		arp.addMapping("z_problem", Problem.class);// 问题
		arp.addMapping("z_topic", Topic.class);// 话题
		arp.addMapping("z_chat", Chat.class);// 聊天记录表

		arp.addMapping("z_problem", ZProblem.class);
		arp.addMapping("z_notice", ZNotice.class);
		arp.addMapping("z_topic", Topic.class);
		arp.addMapping("z_follow", Follow.class);

	}

	/**
	 * 自定义插件
	 */
	@Override
	protected void plugin(Plugins plugins) {
		// 添加数据源
		// 添加自动扫描插件
		// ...
	}

	/**
	 * Run Server
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		JFinal.start("webapp", 8080, "/", 0);
	}

}
